﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Windows;

namespace MagicalDesktop.Simulation
{
    public class Service : NotifyPropertyChanged
    {
        private bool _loggedIn;
        private bool _loginError;

        public string Name { get; set; }
        public string ImagePath { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }

        [XmlIgnore]
        public bool LoggedIn
        {
            get { return _loggedIn; }
            set
            {
                _loggedIn = value;
                RaisePropertyChanged("LoggedIn");
            }
        }

        [XmlIgnore]
        public bool LoginError
        {
            get { return _loginError; }
            set
            {
                _loginError = value;
                RaisePropertyChanged("LoginError");
            }
        }

        public void Login(string userName, string password)
        {
            var loggedIn = UserName.Equals(userName) && Password.Equals(password);
            LoggedIn = loggedIn;
            LoginError = !loggedIn;
        }
    }
}
